﻿
<Window x:Class="MTMultiMouse.WindowList"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    BorderThickness="8,2,8,8" Title="Multi-point TUIO : Pick a window...." WindowStartupLocation="CenterScreen" ResizeMode="NoResize"
    Background="#FF282828"
    BorderBrush="#FF282828" Height="300" Width="500" Foreground="White">
<!--
    <ext:WindowChrome.WindowChrome>
        <ext:WindowChrome RoundCorners="False" RoundCornersRadius="14" CaptionHeight="21"/>
    </ext:WindowChrome.WindowChrome>
   -->
    <Window.Resources>
	<!-- SimpleStyles: TextBox -->

<Style x:Key="{x:Type TextBox}" TargetType="{x:Type TextBox}">

  <Setter Property="SnapsToDevicePixels" Value="True"/>
  <Setter Property="OverridesDefaultStyle" Value="True"/>
  <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
  <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
  <Setter Property="MinWidth" Value="120"/>
  <Setter Property="MinHeight" Value="20"/>
  <Setter Property="AllowDrop" Value="true"/>
  <Setter Property="Template">
    <Setter.Value>
      <ControlTemplate TargetType="{x:Type TextBoxBase}">
        <Border 
          Name="Border"
          CornerRadius="2" 
          Padding="2"
          Background="#595959"
          BorderBrush="#888888"
          BorderThickness="1" >
          <ScrollViewer Margin="0" x:Name="PART_ContentHost"/>
        </Border>
        <ControlTemplate.Triggers>
          <Trigger Property="IsEnabled" Value="False">
            <Setter TargetName="Border" Property="Background" Value="#EEEEEE"/>
            <Setter TargetName="Border" Property="BorderBrush" Value="#EEEEEE"/>
            <Setter Property="Foreground" Value="#888888"/>
          </Trigger>
        </ControlTemplate.Triggers>
      </ControlTemplate>
    </Setter.Value>
  </Setter>
</Style>

        <Style TargetType="{x:Type Button}" x:Key="closeButtonStyle">
            <Setter Property="Visibility" Value="Visible"/>
      <!--      <Setter Property="ext:WindowChrome.HitTestable" Value="True"/> -->
			<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate>
					<Image Source="Resources/close.png" Height="12"/>
				</ControlTemplate>
			</Setter.Value>
			</Setter>
			<!--
            <Style.Triggers>
                <DataTrigger Binding="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=(ext:WindowChrome.WindowChrome).IsGlassEnabled}" Value="True">
                    <Setter Property="Visibility" Value="Hidden"/>
                </DataTrigger>
            </Style.Triggers>
			-->
        </Style>
		
		<!-- SimpleStyles: CheckBox -->

		<Style x:Key="{x:Type CheckBox}" TargetType="{x:Type CheckBox}">
		  <Setter Property="SnapsToDevicePixels" Value="true"/>
		  <Setter Property="OverridesDefaultStyle" Value="true"/>
		  <Setter Property="Template">
		    <Setter.Value>
		      <ControlTemplate TargetType="{x:Type CheckBox}">
		        <BulletDecorator Background="Transparent">
		          <BulletDecorator.Bullet>
		            <Border x:Name="Border"  
		              Width="13" 
		              Height="13" 
		              CornerRadius="0" 
		              Background="#C0C0C0"
		              BorderThickness="1"
		              BorderBrush="#404040">
		              <Path 
		                Width="7" Height="7" 
		                x:Name="CheckMark"
		                SnapsToDevicePixels="False" 
		                Stroke="#404040"
		                StrokeThickness="2"
		                Data="M 0 0 L 7 7 M 0 7 L 7 0" />
		            </Border>
		          </BulletDecorator.Bullet>
		          <ContentPresenter Margin="4,0,0,0"
		            VerticalAlignment="Center"
		            HorizontalAlignment="Left"
		            RecognizesAccessKey="True"/>
		        </BulletDecorator>
		        <ControlTemplate.Triggers>
		          <Trigger Property="IsChecked" Value="false">
		            <Setter TargetName="CheckMark" Property="Visibility" Value="Collapsed"/>
		          </Trigger>
		          <Trigger Property="IsChecked" Value="{x:Null}">
		            <Setter TargetName="CheckMark" Property="Data" Value="M 0 7 L 7 0" />
		          </Trigger>
		          <Trigger Property="IsMouseOver" Value="true">
		            <Setter TargetName="Border" Property="Background" Value="#808080" />
		          </Trigger>
		          <Trigger Property="IsPressed" Value="true">
		            <Setter TargetName="Border" Property="Background" Value="#E0E0E0" />
		            <Setter TargetName="Border" Property="BorderBrush" Value="#606060" />
		          </Trigger>
		          <Trigger Property="IsEnabled" Value="false">
		            <Setter TargetName="Border" Property="Background" Value="#EEEEEE" />
		            <Setter TargetName="Border" Property="BorderBrush" Value="#AAAAAA" />
		            <Setter Property="Foreground" Value="#888888"/>
		          </Trigger>
		        </ControlTemplate.Triggers>
		      </ControlTemplate>
		    </Setter.Value>
		  </Setter>
		</Style>

	  <Style x:Key="ScrollBarLineButton" TargetType="{x:Type RepeatButton}">
		  <Setter Property="SnapsToDevicePixels" Value="True"/>
		  <Setter Property="OverridesDefaultStyle" Value="true"/>
		  <Setter Property="Focusable" Value="false"/>
		  <Setter Property="Template">
		    <Setter.Value>
		      <ControlTemplate TargetType="{x:Type RepeatButton}">
		        <Border 
		          Name="Border"
		          Margin="1" 
		          CornerRadius="2" 
		          Background="#C0C0C0"
		          BorderBrush="#404040"
		          BorderThickness="1">
		          <Path 
		            HorizontalAlignment="Center"
		            VerticalAlignment="Center"
		            Fill="#404040"
		            Data="{Binding Path=Content,RelativeSource={RelativeSource TemplatedParent}}" />
		        </Border>
		        <ControlTemplate.Triggers>
		          <Trigger Property="IsPressed" Value="true">
		            <Setter TargetName="Border" Property="Background" Value="#E0E0E0" />
		          </Trigger>
		          <Trigger Property="IsEnabled" Value="false">
		            <Setter Property="Foreground" Value="#888888"/>
		          </Trigger>
		        </ControlTemplate.Triggers>
		      </ControlTemplate>
		    </Setter.Value>
		  </Setter>
		</Style>

		<Style x:Key="ScrollBarPageButton" TargetType="{x:Type RepeatButton}">
		  <Setter Property="SnapsToDevicePixels" Value="True"/>
		  <Setter Property="OverridesDefaultStyle" Value="true"/>
		  <Setter Property="IsTabStop" Value="false"/>
		  <Setter Property="Focusable" Value="false"/>
		  <Setter Property="Template">
		    <Setter.Value>
		      <ControlTemplate TargetType="{x:Type RepeatButton}">
		        <Border Background="Transparent" />
		      </ControlTemplate>
		    </Setter.Value>
		  </Setter>
		</Style>

		<Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}">
		  <Setter Property="SnapsToDevicePixels" Value="True"/>
		  <Setter Property="OverridesDefaultStyle" Value="true"/>
		  <Setter Property="IsTabStop" Value="false"/>
		  <Setter Property="Focusable" Value="false"/>
		  <Setter Property="Template">
		    <Setter.Value>
		      <ControlTemplate TargetType="{x:Type Thumb}">
		        <Border 
		          CornerRadius="2" 
		          Background="{TemplateBinding Background}"
		          BorderBrush="{TemplateBinding BorderBrush}"
		          BorderThickness="1" />
		      </ControlTemplate>
		    </Setter.Value>
		  </Setter>
		</Style>

		<ControlTemplate x:Key="VerticalScrollBar" TargetType="{x:Type ScrollBar}">
		  <Grid >
		    <Grid.RowDefinitions>
		      <!--<RowDefinition MaxHeight="18"/>-->
		      <RowDefinition Height="0.00001*"/>
		      <!--<RowDefinition MaxHeight="18"/>-->
		    </Grid.RowDefinitions>
		    <Border
		      Grid.RowSpan="1"
		      CornerRadius="2" 
		      Background="#595959" />
		    <!--<RepeatButton 
		      Grid.Row="0"                           
		      Style="{StaticResource ScrollBarLineButton}"
		      Height="18"
		      Command="ScrollBar.LineUpCommand"
		      Content="M 0 4 L 8 4 L 4 0 Z" />-->
		    <Track 
		      Name="PART_Track"
		      Grid.Row="0"
		      IsDirectionReversed="true">
		      <Track.DecreaseRepeatButton>
		        <RepeatButton 
		          Style="{StaticResource ScrollBarPageButton}"
		          Command="ScrollBar.PageUpCommand" />
		      </Track.DecreaseRepeatButton>
		      <Track.Thumb>
		        <Thumb 
		          Style="{StaticResource ScrollBarThumb}" 
		          Margin="1,0,1,0"  
		          Background="#C0C0C0"
		          BorderBrush="#404040" />
		      </Track.Thumb>
		      <Track.IncreaseRepeatButton>
		        <RepeatButton 
		          Style="{StaticResource ScrollBarPageButton}"
		          Command="ScrollBar.PageDownCommand" />
		      </Track.IncreaseRepeatButton>
		    </Track>
		    <!--<RepeatButton 
		      Grid.Row="3" 
		      Style="{StaticResource ScrollBarLineButton}"
		      Height="18"
		      Command="ScrollBar.LineDownCommand"
		      Content="M 0 0 L 4 4 L 8 0 Z"/>-->
		  </Grid>
		</ControlTemplate>
		
		<Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}">
		  <Setter Property="SnapsToDevicePixels" Value="True"/>
		  <Setter Property="OverridesDefaultStyle" Value="true"/>
		  <Style.Triggers>
	
		    <Trigger Property="Orientation" Value="Vertical">
		      <Setter Property="Width" Value="12"/>
		      <Setter Property="Height" Value="Auto" />
			  <Setter Property="Margin" Value="0,0,4,0" />
		      <Setter Property="Template" Value="{StaticResource VerticalScrollBar}" />
		    </Trigger>
			
		  </Style.Triggers>
		</Style>
	
    </Window.Resources>

    <DockPanel x:Name="_NavigationRoot" Margin="0">
        
		<Grid DockPanel.Dock="Top" x:Name="_Caption" Background="#595959">

            <Grid.RowDefinitions>
                <RowDefinition Height="0"/>
                <RowDefinition Height="*"/>
				<RowDefinition Height="70"/>
            </Grid.RowDefinitions>

            <DockPanel Grid.Row="0" VerticalAlignment="Top" Height="21" Background="#FF595959">
                <Button DockPanel.Dock="Right" x:Name="_CloseButton" Click="_CaptionButton_Click" 
					Style="{StaticResource closeButtonStyle}" Margin="0,0,5,0" />

                <TextBlock
                   HorizontalAlignment ="Center"
                   VerticalAlignment="Top"
                   FontFamily="Segoe UI"
                   FontSize="9pt"  
				   Background="#FF595959"
                   Foreground="White"
                   Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=Title}" Margin="0,2,0,0">
                  <TextBlock.Style>
                    <Style>
                        
                      <Style.Triggers>
                          
                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=WindowState}" Value="Maximized">
                          <Setter Property="TextBlock.BitmapEffect" Value="{x:Null}"/>
                          <Setter Property="TextBlock.Foreground" Value="White"/>
                        </DataTrigger>
                      </Style.Triggers>

                    </Style>
                  </TextBlock.Style>
                </TextBlock>
            </DockPanel>

            <ListView ItemsSource="{Binding}" ScrollViewer.CanContentScroll="False" TextBlock.FontFamily="Verdana" TextBlock.FontSize="10pt" Margin="0,21,0,0" Grid.RowSpan="2" 
				BorderBrush="{x:Null}" Background="#FF595959" BorderThickness="0" RenderTransformOrigin="0.5,0.387" Foreground="White"
				x:Name="WindowSelector">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal">
							<Image Source="{Binding Preview}" Margin="2,2,20,2" />
                            <TextBlock Text="{Binding Caption}" TextWrapping="Wrap" Width="280"/>
                        </StackPanel>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
			
			<Grid Grid.Row="2" Background="#595959" Margin="10,0,10,18">
				<Grid.RowDefinitions>
					<RowDefinition Height="18"></RowDefinition>
					<RowDefinition></RowDefinition>
				</Grid.RowDefinitions>
				
				<Grid.ColumnDefinitions>
					<ColumnDefinition></ColumnDefinition>
					<ColumnDefinition></ColumnDefinition>
					<ColumnDefinition></ColumnDefinition>
				</Grid.ColumnDefinitions>
				<Border Grid.ColumnSpan="3" BorderThickness="0,0,0,1" BorderBrush="Silver">
					<TextBlock Grid.ColumnSpan="2" Grid.Row="0" Margin="4,0,0,0">Options</TextBlock>
				</Border>
				
				<StackPanel Grid.Column="0" Grid.Row="1" Margin="0,5,0,0" Orientation="Horizontal">
					<CheckBox Margin="4,2,0,0" x:Name="UseTCP" Click="UseTCP_Checked"></CheckBox>
					<TextBlock>Use TCP/IP (Flash)</TextBlock>
				</StackPanel>
				
				<StackPanel Grid.Column="1" Grid.Row="1" Orientation="Horizontal">
					<TextBlock Margin="0,5">Port</TextBlock>
					<TextBox Margin="10,5,0,8" Width="100" Text="3333" Height="20" x:Name="PortInput"/>
				</StackPanel>
				
				<Button Grid.Row="1" Grid.Column="2" Width="60" Height="25" 
					HorizontalAlignment="Right" TextBlock.FontWeight="Bold" x:Name="GoButton" Content="Go!" Click="GoButton_Click">
					
				</Button>
			</Grid>
        </Grid>
    </DockPanel> 
</Window>
